package com.ap.core.validation.message.rules;

import java.math.BigDecimal;

import com.ap.core.domain.Amount;
import com.ap.core.message.managerefund.info.RequestRetrieveRefundAccountInfo;
import com.ap.core.validation.message.info.MessageValidationInfo;
import com.ap.core.validation.message.info.OriginalInfo;
import com.ap.core.validation.rules.AbstractValidationRule;

/**
 * User: Gibu.Paul Check if the Total Payment Request Amount is zero or negative
 */
public class SF0001RefundRequestRule
		extends
		AbstractValidationRule<MessageValidationInfo<RequestRetrieveRefundAccountInfo, OriginalInfo>> {

	@Override
	public boolean validate(
			MessageValidationInfo<RequestRetrieveRefundAccountInfo, OriginalInfo> infoObject) {
		BigDecimal totalPaymentRequestAmount = null;

		totalPaymentRequestAmount =  infoObject
				.getBoundObject().getRefundRequestInfo().getRefundAmount();

		return Amount.valueOf(totalPaymentRequestAmount).isGreaterThan(
				Amount.valueOf(BigDecimal.ZERO));
	}

}
